<cfprocessingdirective pageEncoding="utf-8" suppresswhitespace="Yes">
<cfset sMessage = "">
<cfparam name="sPage" default="#replacenocase(CGI.SCRIPT_NAME,"logout","")#">

<cfif isdefined("valider")>
	<cfinvoke component="components/logique_utilisateurs" method="fGetLogin" returnvariable="infosLogin">
		<cfinvokeargument name="sEmail" value="#identifiant#">
		<cfinvokeargument name="sMotDePasse" value="#password#">
	</cfinvoke>
	
	<cfif infosLogin.bValideLogin>
		<cfset session.stLogin = structnew()>
		<cfset session.stLogin.sIdentifiant = infosLogin.sIdentifiant>
		<cfset session.stLogin.idUser = infosLogin.idUser>
		<cfset session.stLogin.sNom = infosLogin.sNom>
		<cfset session.stLogin.sPrenom = infosLogin.sPrenom>
		
		<cfcookie value="#session.stLogin.sIdentifiant#" name="gestionProjets" expires="never">
		
		<cflocation url="#sPage#">
	<cfelse>
		<cfset sMessage = "Mauvais identifiant et/ou mot de passe">
	</cfif>
</cfif>

<!DOCTYPE html>
<html lang="fr">
<head>  
	<meta charset="utf-8" />
	<title>Identification</title>
	<link rel="stylesheet" href="ressources/design.css" />
</head>

<body>
<br><br><br><br><br>
<table align="center" width="500">
<tr>
	<td class="headerFooterTable" height="54">&nbsp;Gestion de projet : identification</td>
</tr>
<tr>
	<td class="bodyTableConnexion" align="center" height="220">
		
		<table><cfform method="post" name="formulaire" action="#sPage#">
		<input type="hidden" name="sPage" value="<cfoutput>#sPage#</cfoutput>">
		<tr>
			<td width="130" align="left">Identifiant :</td>
			<td align="left"><cfinput class="inputLogin" type = "text" name = "identifiant" tooltip = "Votre email" required = "true" message = "Identifiant obligatoire" maxlength = "50" size="20"></td>
		</tr>
		<tr>
			<td align="left">Mot de Passe :</td>
			<td align="left"><cfinput class="inputLogin" type = "password" name = "password" required = "true" message = "Mot de passe obligatoire" maxlength = "50" size="20"></td>
		</tr>
		<tr>
			<td colspan="2" class="messageAlerte">
			<cfif sMessage neq ""><cfoutput>#sMessage#</cfoutput><cfelse>&nbsp;</cfif>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td align="right"><cfinput id="valider" type = "Submit" name = "valider" value = "Connexion" class="boutonValiderLogin"></td>
		</tr></cfform>
		</table>
		
	</td>
</tr>
<tr>
	<td class="headerFooterTable" height="54">&nbsp;</td>
</tr>
</table>

</body>

</html>

</cfprocessingdirective>